package com.example.webview;

import android.content.Context;
import android.os.Build;
import android.webkit.JavascriptInterface;
import android.widget.Toast;

/**
 * Created by Administrator on 2017/1/9.
 */

public class MyClass {

    private Context context;

    public MyClass(Context context) {
        this.context = context;
    }

    @JavascriptInterface
    public void show(){

        Toast.makeText(context,"js/html调用的安卓方法",Toast.LENGTH_LONG).show();
    }

    //注意  17以后必须添加此注解 否则调用无效
    @JavascriptInterface
    public String getInfo(){

        return "手机型号"+ Build.DEVICE+"手机Api版本:"+Build.VERSION.SDK_INT;
    }
}
